class Solution {
    int sum = 0;
    int path = 0;
    public int subsetXORSum(int[] nums) {
        dfs(nums, 0);
        return sum;
    }
    public void dfs(int[] nums, int pos){
        sum += path;
        for(int i = pos; i < nums.length; i++){
            path ^= nums[i];
            dfs(nums, i + 1);
            path ^= nums[i];
        }
    }
}